#include "laig2plog.h"
#include <vector>

int main(int argc, char** argv) {

	// Some tests
	char *cmd;
	cmd = createCommand("comando", "30000", "4000");
	//printf("fullCommand: %s \n", cmd);
	delete[] cmd;

	vector<char> v (100, '0');
	char *test = vectorToChar(v, 3);
	//printf("test: %s\n", test); 

	if (argc != 3 ) {
		printf("usage example:\n %s 127.0.0.1 12345 \n", argv[0]);
		getchar();
		return -1;
	}

	SOCKET m_socket;
	socketConnect(&m_socket, argv[1], argv[2]);

	char *resp1;
	resp1 = exchange(&m_socket, "hi.\n");
	printf("resp: %s\n", resp1);

	char *resp3;
	resp3 = exchange(&m_socket, "hi2.\n");
	printf("resp: %s\n", resp3);

	char *resp;
	resp = exchange(&m_socket, "initialize.\n");
	printf("resp: %s\n", resp);

	vector<char> vectorBoard;
	prologCharToVector(vectorBoard, resp);

	//for(unsigned i=0; i < vectorBoard.size(); i++)
	//	printf("%c,",vectorBoard[i]);

	// format of second argument is "'%Movement',Player"
	char *resp2 = executePlay(&m_socket, vectorBoard, "'1615',2");
	printf("\n %s \n", resp2);

	delete[] resp;

	/*
	// Checks end
	char *check;
	check = checkEnd(&m_socket, v, "1");
	delete[] check;
	*/

	quit(&m_socket);
	getchar();
	return 0;
}